package com.boot.controller;

import com.boot.entity.User;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Api(tags="说明该类的作用，可以在ui界面上看到的注解",value = "该参数没什么意义，在UI界面上也看到，所以不需要配置")
@RestController
public class HelloWorldController {

    @ApiOperation(value = "说明方法的用途、作用value",notes = "方法的备注说明notes")
    @RequestMapping("/helloWorld")
    public String helloWorld(){
        return "helloWorld";
    }

    @ApiOperation(value = "获取用户列表",notes = "根据用户名、密码获取用户列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userName",value = "用户名",required = true,paramType = "query",dataType = "String",defaultValue = "默认值"),
            @ApiImplicitParam(name = "password",value = "密码",required = true,paramType = "query",dataType = "String",defaultValue = "默认值")
    })
    @GetMapping("/getUsers")
    public List<User> getUsers(String userName,String password){
        return Arrays.asList(new User(1L,"张三","123456"));
    }
}
